package View
{
	import View.UIComponent.UIButton;
	
	import Vo.Image;
	
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.system.ApplicationDomain;
	import flash.system.System;

	public class UICanvas extends Sprite
	{
		/***
		 *  构建一个切换视图的面板  俩个按钮
		 * */
		public var nextBtn:UIButton;
		public var backBtn:UIButton;
		public var imageCanvas:Image;
		private var container:Sprite;
		public function UICanvas()
		{
			
		}
		public function createButton():void
		{
			try
			{
				var back:Class=ApplicationDomain.currentDomain.getDefinition("Back") as Class;
				var next:Class=ApplicationDomain.currentDomain.getDefinition("Next") as Class;
			}
			catch(e:Error)
			{
				trace(e.message);
			}
			nextBtn=new UIButton(back);
			backBtn=new UIButton(next);
			addChild(nextBtn);
			addChild(backBtn);
			nextBtn.buttonMode=true;
			backBtn.buttonMode=true;
			backBtn.x=420;
			backBtn.y=50;
			nextBtn.y=50;
			nextBtn.x=50;
			container=new Sprite();
			container.graphics.beginFill(0xF6EAEA,1);
			container.graphics.drawRect(50,70,370,350);
			container.graphics.endFill();
			addChild(container);
			addEventListener(Event.FRAME_CONSTRUCTED,onFrame);
		}
		public function onFrame(e:Event):void
		{
			trace(System.totalMemory);
		}
		public function addBitmap(bitmap:Image):void
		{
			while(container.numChildren>0)
			{
				container.removeChildAt(0);
			}
			container.addChild(bitmap);
		}
	}
}